package priv.lirenhe.dissertation.service.impl;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import priv.lirenhe.dissertation.dao.mysql.impl.WebPageMapperImpl;
import priv.lirenhe.dissertation.domain.mysql.WebPage;
import priv.lirenhe.dissertation.domain.mysql.WebPageExample;
import priv.lirenhe.dissertation.domain.mysql.WebPageWithBLOBs;
import priv.lirenhe.dissertation.service.WebPageService;
import priv.lirenhe.dissertation.utils.TimeUtil;

@Service("WebPageServiceImpl")
public class WebPageServiceImpl implements WebPageService{

	@Autowired
	WebPageMapperImpl webPageMapperImpl = null;
	
	@Override
	public long getCountPageByExample(WebPageExample example) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int deletePageByExample(WebPageExample example) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int deletePageByPrimaryKey(Long webPageId) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insertPage(WebPageWithBLOBs record) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	@Override
	public int insertPageSelective(Map<String,String> map) {
		
		WebPageWithBLOBs webPageWithBLOBs = new WebPageWithBLOBs();
		webPageWithBLOBs.setWebPageRealurl(map.get("webPageRealurl"));
		webPageWithBLOBs.setWebPageTitle(map.get("webPageTitle"));
		webPageWithBLOBs.setWebPageContentCode(map.get("webPageContentCode"));
		webPageWithBLOBs.setWebPageContentText(map.get("webPageContentText"));
		
		try {
			webPageWithBLOBs.setWebPageFirstInDbTimestamp(new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(TimeUtil.getNowTime()));
		} catch (ParseException e) {
			e.printStackTrace();
		}
		
		int i = webPageMapperImpl.insertSelective(webPageWithBLOBs);
		return i;
	}

	@Override
	public List<WebPageWithBLOBs> selectPageByExampleWithBLOBs(
			WebPageExample example) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<WebPage> selectPageByExample(WebPageExample example) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public WebPageWithBLOBs selectPageByPrimaryKey(Long webPageId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int updatePageByExampleSelective(WebPageWithBLOBs record,
			WebPageExample example) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int updatePageByExampleWithBLOBs(WebPageWithBLOBs record,
			WebPageExample example) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int updatePageByExample(WebPage record, WebPageExample example) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int updatePageByPrimaryKeySelective(WebPageWithBLOBs record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int updatePageByPrimaryKeyWithBLOBs(WebPageWithBLOBs record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int updatePageByPrimaryKey(WebPage record) {
		// TODO Auto-generated method stub
		return 0;
	}

}
